﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VPLink2014.Data.MesApplis
{
	public class TeamFactory
	{
		public VOTeamMapper CreateTeam( string teamType, string teamName )
		{
			switch( teamType )
			{
				case "direction":
					return new VODirectionMapper( teamName );
				case "departement":
					return new VODepartementMapper( teamName );
				case "service":
					return new VOServiceMapper( teamName );
				default : return null;
			}
		}
		public List<VOApplication> GetAllOrphanApplications()
		{
			return VPLinkLogCatalogue.GetAllOrphanApplications();
		}
		public List<VOTeam> GetAllTeams(string teamType)
		{
			List<VOTeam> allteams = new List<VOTeam>();
			switch( teamType )
			{
				case "direction":
					{
						foreach( VODirection dir in VPLinkLogCatalogue.getDirections() )
						{
							allteams.Add( new VOTeam() { Id = dir.Id, Name = dir.Name } );
						}
						break;
					}
				case "departement":
					{
						foreach( VODepartement dept in VPLinkLogCatalogue.getDepartements() )
						{
							allteams.Add( new VOTeam() { Id = dept.Id, Name = dept.Name } );
						}
						break;
					}
				case "service":
					{
						foreach( VOService sce in VPLinkLogCatalogue.getServices() )
						{
							allteams.Add( new VOTeam() { Id = sce.Id, Name = sce.Name } );
						}
						break;
					}
			}
			return allteams;
		}
	}
}
